﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BoCaiWeb.WebSite.Code;
using BoCaiWeb.Business;
using BoCaiWeb.Model;
using Ajeelee.Core.Utils;

namespace BoCaiWeb.WebSite
{
    public partial class lanmu : PageBase
    {
        protected int id;
        protected string pname = "";
        protected LanMuInfo lanMuInfo;
        ILanMuInfoBusiness lanMuInfoBll = new LanMuInfoBusinessFactory().CreateLanMuInfoBusiness();

        protected void Page_Load(object sender, EventArgs e)
        {
            // 获取参数
            id = QueryParamInt32("id");

            if (id > 0)
            {
                try
                {
                    //
                    lanMuInfo = lanMuInfoBll.GetById(id);
                    if (lanMuInfo != null)
                    {
                        LanMuInfo pitem = Utility.GetParentLanMu().FirstOrDefault(l => l.Id == lanMuInfo.PId);
                        if (pitem != null)
                        {
                            pname = pitem.Name;
                        }
                        switch (lanMuInfo.PId)
                        {
                            case 1: // 关于博才
                                this.lefter1.CurrentNavType = NavigationType.About;
                                break;
                            case 2: // 客户服务
                                this.lefter1.CurrentNavType = NavigationType.Server;
                                break;
                            case 4: // 联系我们
                                this.lefter1.CurrentNavType = NavigationType.Link;

                                break;
                        }

                    }
                }
                catch (Exception ex)
                {
                    Function.WriteErrorLog(ex);
                }
            }
            if (lanMuInfo == null)
            {
                lanMuInfo = new LanMuInfo();
                Page_GoTo("404.aspx");
            }
        }
    }
}